<template>
	<om-page title="个人资料" style="background-color: #E7EBED;">
			<uni-list>
				<uni-list-item :showArrow="true" @click="avatarClick">
					<view class="tui-flex">
						<view class="tui-col-4 "><om-label label="头像" style="line-height: 32px;"></om-label></view>
						<view class="tui-right tui-col-8">
							<view class="cu-avatar round margin-left" :style="'background-image:url('+om.getAvatar()+');'"></view>
						</view>
					</view>
				</uni-list-item>
				
			</uni-list>
			<om-white-space></om-white-space>
			<uni-list>
				<view v-for="(item, index) in items" :key="index">
					<uni-list-item :showArrow="false">
						<view class="tui-flex">
							<view class="tui-left tui-col-4 om-label">{{ item.name }}</view>
							<view class="tui-right tui-col-8 om-content">{{ item.value ? item.value : '' }}</view>
						</view>
					</uni-list-item>
				</view>
			</uni-list>
			<view style="height: 90px;"></view>
			<view  class="padding flex om-bottom-btn" style="justify-content: space-between;">
				<button class="om-bg"  style="color: #FFFFFF;width:100%" @tap="changeInfo">修改个人信息</button>
			</view>
	</om-page>
</template>

<script>
import { mapState } from 'pinia';
import {
		useLoginUserStore
	} from '@/stores/login-user.js';
export default {
	data(){
		return {
			items:[]
		}
	},
	computed: {
		...mapState(useLoginUserStore, ['hasLogin', 'forcedLogin', 'userName','userId','avatar','sexCode'])
	},
	methods: {
		changeInfo(){
			uni.navigateTo({
				url:"/pages/form/hr-u-adjustinfo/new-u-adjustinfo?title=个人信息调整&code=RPS0201"
			})
		},
		avatarClick(){
			uni.navigateTo({
				url:"./avatar"
			})
			// let _that = this
			// uni.chooseImage({
			// 	count:1,
			// 	success: function (res) {
			// 		console.log(JSON.stringify(res.tempFilePaths));
			// 		if(res.tempFilePaths.length){
			// 			_that.userAvator = res.tempFilePaths[0]
			// 		}
			// 	}
			// })
		},
	},
	onLoad(options) {
		let _that = this
		_that.om.request('wxCommon/getColumnInfo',{
			tableMark:"KEY_31",
			id:_that.userId
		}).then(res=>{
			if(res.succeed){
				_that.items = res.value
			}else{
				_that.om.toast(res.msg)
			}
		})
	}
};
</script>

<style>
.page {
	background-color: #e5e5e5;
	height: 100%;
}

.om-bottom {
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100rpx;
	position: fixed;
	bottom: 150rpx;
	width: 100%;
	z-index: 10000;
	border-top-color: #ddd;
	background-color: #007aff;
	color: #ecf6fd;
}
</style>
